@echo off
where scoop.cmd /q || (echo 未检测到Scoop包管理器, 即将启动Scoop安装)&&(curl https://gitee.com/YWtheGod/GZEIC/raw/master/ScoopSetup.bat -s -O&&call ScoopSetup)
where code /q || goto :INSTALLVSCODE
echo 检测VS CODE已经安装，请自行安装升级相关插件
:CHECKCONDA
where conda /q || goto :INSTALLCONDA
:UPDATECONDA
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes
mamba update  --yes --all
exit /b

:INSTALLVSCODE
call scoop install vscode
For /f %%i in ('call scoop prefix vscode') do set "VSCODEPATH=%%i"
reg import "%VSCODEPATH%\install-associations.reg" >NUL
path %VSCODEPATH%\bin;%path%
REM git clone --branch Python https://gitee.com/YWtheGod/vscodeext %VSCODEPATH%\..\..\..\persist\VSCODE\VSCODEPYEXT
REM rd /s /q %VSCODEPATH%\..\..\..\persist\VSCODE\data\extensions >NUL 2>&1
REM move %VSCODEPATH%\..\..\..\persist\VSCODE\VSCODEPYEXT %VSCODEPATH%\..\..\..\persist\VSCODE\data\extensions >NUL
REM mkdir %VSCODEPATH%\..\..\..\persist\VSCODE\data\user-data\User>NUL 2>&1
REM echo { >%VSCODEPATH%\..\..\..\persist\VSCODE\data\user-data\User\settings.json
REM REM echo     "terminal.integrated.defaultProfile.windows": "Command Prompt">>%VSCODEPATH%\..\..\..\persist\VSCODE\data\user-data\User\settings.json
REM echo } >>%VSCODEPATH%\..\..\..\persist\VSCODE\data\user-data\User\settings.json
REM call code --locale zh-CN
rd /s /q %VSCODEPATH%\..\..\..\persist\VSCODE >NUL 2>&1
git clone --single-branch --branch python https://gitee.com/YWtheGod/vscodeext %VSCODEPATH%\..\..\..\persist\VSCODE
goto :CHECKCONDA

:INSTALLCONDA
call scoop install mambaforge@23.3.1-1
For /f %%i in ('call scoop prefix mambaforge') do set "CONDAPATH=%%i"
path %CONDAPATH%\scripts;%CONDAPATH%\Library\bin;%path%
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
conda init cmd.exe
goto :UPDATECONDA
